﻿using S7.Net.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TYPLC.PLC;

namespace TYPLC {
    public delegate void DelegateOnDataChange(string groupName, int index, object value);
    public abstract class IPLCConnector {
        public bool IsRun = true;

        public bool IsConnected { get; set; }
        public abstract bool Read(string groupName, int tagIndex, out object data);
        public abstract bool Write(string groupName, int index, object value);
        public abstract bool GetTagType(string groupName, int index, out PLCDataType dataType);
        public abstract bool Start();
        public abstract bool Connect();
        public abstract bool AddGroup(GroupPara groupPara);

        public event DelegateOnDataChange OnDataChange;
        public void FireDatChange(string groupName, int index, object value) {
            this.OnDataChange?.BeginInvoke(groupName, index, value, null, null);
        }

    }
}
